<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Motion Interface (TCPWM)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__tcpwm__motif.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">Motion Interface (TCPWM)<div class="ingroups"><a class="el" href="group__group__tcpwm.html">TCPWM        (Timer Counter PWM)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>Driver API for Motion Interface. </p>
<p>The functions and other declarations used in this part of the driver are in cy_tcpwm_motif.h. You can also include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<p>The MOTIF unit is a flexible and powerful component for motor control systems that use Rotary Encoders, Hall Sensors as feedback loop. The several configuration schemes of the module, target a very large universe of motor control application requirements. This enables the build of simple and complex control feedback loops, for industrial and automotive motor applications, targeting high performance motion and position monitoring.</p>
<p>Each MOTIF module can operate in four different modes,</p><ul>
<li>Quadrature Decoder</li>
<li>Hall Sensor</li>
<li>Stand-alone Multi-channel Mode</li>
<li>Quadrature mode with stand-alone Multi-channel.</li>
</ul>
<p>The MOTIF module has the following features:</p><ul>
<li>Interface for position measurement.</li>
<li>Interface for motor revolution measurement.</li>
<li>Interface for velocity measurement.</li>
<li>Interrupt sources for phase error, motor revolution, direction change and error on phase decoding</li>
<li>Simple build-in mode for brush less DC motor control.</li>
<li>Shadow register for the multi-channel pattern.</li>
<li>Complete synchronization with the PWM signals and the multi-channel pattern update</li>
<li>Interrupt sources for Correct Hall Event detection, Wrong Hall Event Detection</li>
<li>Previous and Expected Pattern monitoring to detect less torque situations</li>
<li>Input and output Look-up table for automatic modulation control</li>
<li>Simple usage with Hall Sensor Mode</li>
<li>Stand-alone Multi-Channel mode</li>
<li>Shadow register for the multi-channel pattern</li>
<li>Output Look-up table for automatic modulation control</li>
<li>Second Compare Match (CC_MATCH1) event is only available in TCPWM Version 2.</li>
</ul>
<h1><a class="anchor" id="group_tcpwm_motif_configuration"></a>
Configuration Considerations</h1>
<p>The QuadDec configuration can be divided to number of sequential steps listed below:</p><ul>
<li><a class="el" href="group__group__tcpwm__motif.html#group_tcpwm_motif_config">Configure MOTIF Module</a></li>
<li><a class="el" href="group__group__tcpwm__motif.html#group_tcpwm_motif_clock">Assign Clock Divider</a></li>
<li><a class="el" href="group__group__tcpwm__motif.html#group_tcpwm_motif_enable">Enable Motion interface module</a></li>
<li><a class="el" href="group__group__tcpwm__motif.html#group_tcpwm_motif_start">Start MOTIF block</a></li>
</ul>
<h2><a class="anchor" id="group_tcpwm_motif_config"></a>
Configure MOTIF Module</h2>
<p>To configure MOTIF module in HALL Sensor mode, Quadrature mode, Multi Channel Pattern mode provide the configuration parameters in the <a class="el" href="structcy__stc__tcpwm__motif__hall__sensor__config__t.html">cy_stc_tcpwm_motif_hall_sensor_config_t</a> structure for Hall Sensor Mode. <a class="el" href="structcy__stc__tcpwm__motif__mcp__config__t.html">cy_stc_tcpwm_motif_mcp_config_t</a> structure for Multi Channel Pattern Mode. <a class="el" href="structcy__stc__tcpwm__motif__quaddec__config__t.html">cy_stc_tcpwm_motif_quaddec_config_t</a> structure for Quadrature Mode. The Configuration structure can be modified through software, but if the configurator in ModusToolbox is used then the configuration structure will be updated with the users input. To initialize the driver, call <a class="el" href="group__group__tcpwm__functions__motif__hall.html#ga51c97ad1e41d71ba64b6a95135c8dcac">Cy_TCPWM_MOTIF_Hall_Sensor_Init</a> <a class="el" href="group__group__tcpwm__functions__motif__mcp.html#ga7fe782a0d1c7aa82d07b0edad80a4692">Cy_TCPWM_MOTIF_MCP_Init</a> <a class="el" href="group__group__tcpwm__functions__motif__quaddec.html#ga06dd7028e721f2e401dde1af7f0f68a5">Cy_TCPWM_MOTIF_Quaddec_Init</a> function providing a pointer to the populated <a class="el" href="structcy__stc__tcpwm__motif__hall__sensor__config__t.html">cy_stc_tcpwm_motif_hall_sensor_config_t</a> <a class="el" href="structcy__stc__tcpwm__motif__mcp__config__t.html">cy_stc_tcpwm_motif_mcp_config_t</a> <a class="el" href="structcy__stc__tcpwm__motif__quaddec__config__t.html">cy_stc_tcpwm_motif_quaddec_config_t</a> structures respectively.</p>
<h2><a class="anchor" id="group_tcpwm_motif_clock"></a>
Assign Clock Divider</h2>
<p>The clock source must be connected to proper working. Any of the peripheral clock dividers could be used. Use the <a class="el" href="group__group__sysclk.html">SysClk (System Clock)</a> driver API to do that.</p>
<h2><a class="anchor" id="group_tcpwm_motif_enable"></a>
Enable Motion interface module</h2>
<p>MOTIF block has to be enabled before starting</p>
<h2><a class="anchor" id="group_tcpwm_motif_start"></a>
Start MOTIF block</h2>
<p>MOTIF has to be started </p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__tcpwm__macros__motif"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__macros__motif.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__functions__motif"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__functions__motif.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__functions__motif__hall"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__functions__motif__hall.html">HALL Sensor specific functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__functions__motif__mcp"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__functions__motif__mcp.html">Multi-Channel specific functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__functions__motif__quaddec"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__functions__motif__quaddec.html">Quadrature decoder specific functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__data__structures__motif"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__data__structures__motif.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
